<html>
<head><meta charset="utf-8"><title>Annoying crash in rust-analyzer, how to debug? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html">Annoying crash in rust-analyzer, how to debug?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196890028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Egger <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890028">(May 08 2020 at 12:38)</a>:</h4>
<p>I have this super weird crash of rust-analyzer both in vim (with coc plugin) and VSCode in some actix code but I've no idea how to debug this without any editor running as I can't find this information in the repository.</p>
<p>As soon as I try to crank up the debugging by enabling full stacktraces the the panic vanishes and an error messages about a long running loop occurs instead. This is the panic I'm trying to figure out:</p>
<div class="codehilite"><pre><span></span><code>stack backtrace:
   0: &lt;std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display&gt;::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::str::slice_error_fail
   9: core::str::traits::&lt;impl core::slice::SliceIndex&lt;str&gt; for core::ops::range::Range&lt;usize&gt;&gt;::index::{{closure}}
  10: ra_ide::display::function_signature::FunctionSignature::from_struct
  11: ra_ide::inlay_hints::get_param_name_hints
  12: ra_ide::inlay_hints::inlay_hints
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: ra_db::CheckCanceled::catch_canceled
  16: ra_ide::Analysis::inlay_hints
  17: rust_analyzer::main_loop::handlers::handle_inlay_hints
  18: &lt;F as threadpool::FnBox&gt;::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</code></pre></div>


<p>Is there any easy would from the CLI to trigger the function in line 10 from the CLI?</p>



<a name="196890099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890099">(May 08 2020 at 12:39)</a>:</h4>
<p>Might be <a href="https://github.com/rust-analyzer/rust-analyzer/pull/4359/" title="https://github.com/rust-analyzer/rust-analyzer/pull/4359/">https://github.com/rust-analyzer/rust-analyzer/pull/4359/</a></p>



<a name="196890221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890221">(May 08 2020 at 12:40)</a>:</h4>
<p>To get better stack traces you don't need to set <code>RUST_BACKTRACE=full</code>, but rather bump <code>debug</code> to <code>1</code> or <code>2</code> in rust-analyzer's <code>Cargo.toml</code> and rebuild it</p>



<a name="196890386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Egger <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890386">(May 08 2020 at 12:42)</a>:</h4>
<p>I'm seeing this with a version one commit ahead of this PR.</p>



<a name="196890525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Egger <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890525">(May 08 2020 at 12:43)</a>:</h4>
<p>Will retry with a bumped debug setting but it would be great if I could trigger the bug outside of an editor.</p>



<a name="196890758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890758">(May 08 2020 at 12:46)</a>:</h4>
<p>I think the panic is at <a href="https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L88" title="https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L88">https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L88</a></p>



<a name="196890768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890768">(May 08 2020 at 12:46)</a>:</h4>
<p>Hm, yeah, that code is def still broken, it dies <code>[1..]</code> all over the place :-(</p>



<a name="196890805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890805">(May 08 2020 at 12:46)</a>:</h4>
<p>There are four potential panics there :-)</p>



<a name="196890880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890880">(May 08 2020 at 12:47)</a>:</h4>
<p>Should that code use <code>Display</code> and split stuff out of strings? It seems a bit finicky.</p>



<a name="196890884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196890884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196890884">(May 08 2020 at 12:47)</a>:</h4>
<p>But only one string indexing as in the backtrace, right?</p>



<a name="196891185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196891185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196891185">(May 08 2020 at 12:50)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L3-L4" title="https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L3-L4">https://github.com/rust-analyzer/rust-analyzer/blob/f4cd75ac06dff7f5a95065a6c3868669e5c2ab27/crates/ra_ide/src/display/function_signature.rs#L3-L4</a> <span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span>  ^^</p>



<a name="196892508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Annoying%20crash%20in%20rust-analyzer%2C%20how%20to%20debug%3F/near/196892508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Egger <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Annoying.20crash.20in.20rust-analyzer.2C.20how.20to.20debug.3F.html#196892508">(May 08 2020 at 13:03)</a>:</h4>
<p>Hm... <code>[ERROR rust_analyzer::main_loop] overly long loop turn: 594.980266ms</code></p>
<p>And of course with debug=2, I can't reproduce the panic anymore...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>